<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>CANopenNode: Trace</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">CANopenNode
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__CO__trace.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#files">Files</a> &#124;
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Trace<div class="ingroups"><a class="el" href="group__CO__CANopen__extra.html">CANopen_extra</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>CANopen trace object for recording variables over time.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="files"></a>
Files</h2></td></tr>
<tr class="memitem:CO__trace_8h"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="CO__trace_8h.html">CO_trace.h</a></td></tr>
<tr class="memdesc:CO__trace_8h"><td class="mdescLeft">&#160;</td><td class="mdescRight">CANopen trace object for recording variables over time. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structCO__trace__dataType__t.html">CO_trace_dataType_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">structure for reading variables and printing points for specific data type.  <a href="structCO__trace__dataType__t.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structCO__trace__t.html">CO_trace_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Trace object.  <a href="structCO__trace__t.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ga4edaf4c29180028f5f128f0aed2a417d"><td class="memItemLeft" align="right" valign="top"><a id="ga4edaf4c29180028f5f128f0aed2a417d"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CO__trace.html#ga4edaf4c29180028f5f128f0aed2a417d">OD_INDEX_TRACE_CONFIG</a>&#160;&#160;&#160;0x2301</td></tr>
<tr class="memdesc:ga4edaf4c29180028f5f128f0aed2a417d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start index of traceConfig and Trace objects in Object Dictionary. <br /></td></tr>
<tr class="separator:ga4edaf4c29180028f5f128f0aed2a417d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga50621e5b8e28349f7caf260b6cf9962e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CO__trace.html#ga50621e5b8e28349f7caf260b6cf9962e">CO_trace_init</a> (<a class="el" href="structCO__trace__t.html">CO_trace_t</a> *trace, <a class="el" href="structCO__SDO__t.html">CO_SDO_t</a> *SDO, <a class="el" href="group__CO__dataTypes.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> enabled, <a class="el" href="group__CO__dataTypes.html#ga33594304e786b158f3fb30289278f5af">uint32_t</a> *timeBuffer, <a class="el" href="group__CO__dataTypes.html#gadb828ef50c2dbb783109824e94cf6c47">int32_t</a> *valueBuffer, <a class="el" href="group__CO__dataTypes.html#ga33594304e786b158f3fb30289278f5af">uint32_t</a> bufferSize, <a class="el" href="group__CO__dataTypes.html#ga33594304e786b158f3fb30289278f5af">uint32_t</a> *map, <a class="el" href="group__CO__dataTypes.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *format, <a class="el" href="group__CO__dataTypes.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *trigger, <a class="el" href="group__CO__dataTypes.html#gadb828ef50c2dbb783109824e94cf6c47">int32_t</a> *threshold, <a class="el" href="group__CO__dataTypes.html#gadb828ef50c2dbb783109824e94cf6c47">int32_t</a> *value, <a class="el" href="group__CO__dataTypes.html#gadb828ef50c2dbb783109824e94cf6c47">int32_t</a> *minValue, <a class="el" href="group__CO__dataTypes.html#gadb828ef50c2dbb783109824e94cf6c47">int32_t</a> *maxValue, <a class="el" href="group__CO__dataTypes.html#ga33594304e786b158f3fb30289278f5af">uint32_t</a> *triggerTime, <a class="el" href="group__CO__dataTypes.html#ga1f1825b69244eb3ad2c7165ddc99c956">uint16_t</a> idx_OD_traceConfig, <a class="el" href="group__CO__dataTypes.html#ga1f1825b69244eb3ad2c7165ddc99c956">uint16_t</a> idx_OD_trace)</td></tr>
<tr class="memdesc:ga50621e5b8e28349f7caf260b6cf9962e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize trace object.  <a href="#ga50621e5b8e28349f7caf260b6cf9962e">More...</a><br /></td></tr>
<tr class="separator:ga50621e5b8e28349f7caf260b6cf9962e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5b8d9460d7a42920325cf66eb8b725ec"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CO__trace.html#ga5b8d9460d7a42920325cf66eb8b725ec">CO_trace_process</a> (<a class="el" href="structCO__trace__t.html">CO_trace_t</a> *trace, <a class="el" href="group__CO__dataTypes.html#ga33594304e786b158f3fb30289278f5af">uint32_t</a> timestamp)</td></tr>
<tr class="memdesc:ga5b8d9460d7a42920325cf66eb8b725ec"><td class="mdescLeft">&#160;</td><td class="mdescRight">Process trace object.  <a href="#ga5b8d9460d7a42920325cf66eb8b725ec">More...</a><br /></td></tr>
<tr class="separator:ga5b8d9460d7a42920325cf66eb8b725ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>CANopen trace object for recording variables over time. </p>
<p>In embedded systems there is often a need to monitor some variables over time. Results are then displayed on graph, similar as in oscilloscope.</p>
<p>CANopen trace is a configurable object, accessible via CANopen Object Dictionary, which records chosen variable over time. It generates a curve, which can be read via SDO and can then be displayed in a graph.</p>
<p><a class="el" href="group__CO__trace.html#ga5b8d9460d7a42920325cf66eb8b725ec" title="Process trace object. ">CO_trace_process()</a> runs in 1 ms intervals and monitors one variable. If it changes, it makes a record with timestamp into circular buffer. When trace is accessed by CANopen SDO object, it reads latest points from the the circular buffer, prints a SVG curve into string and sends it as a SDO response. If a SDO request was received from the same device, then no traffic occupies CAN network. </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga50621e5b8e28349f7caf260b6cf9962e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga50621e5b8e28349f7caf260b6cf9962e">&#9670;&nbsp;</a></span>CO_trace_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CO_trace_init </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structCO__trace__t.html">CO_trace_t</a> *&#160;</td>
          <td class="paramname"><em>trace</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structCO__SDO__t.html">CO_SDO_t</a> *&#160;</td>
          <td class="paramname"><em>SDO</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a>&#160;</td>
          <td class="paramname"><em>enabled</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#ga33594304e786b158f3fb30289278f5af">uint32_t</a> *&#160;</td>
          <td class="paramname"><em>timeBuffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#gadb828ef50c2dbb783109824e94cf6c47">int32_t</a> *&#160;</td>
          <td class="paramname"><em>valueBuffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#ga33594304e786b158f3fb30289278f5af">uint32_t</a>&#160;</td>
          <td class="paramname"><em>bufferSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#ga33594304e786b158f3fb30289278f5af">uint32_t</a> *&#160;</td>
          <td class="paramname"><em>map</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *&#160;</td>
          <td class="paramname"><em>format</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *&#160;</td>
          <td class="paramname"><em>trigger</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#gadb828ef50c2dbb783109824e94cf6c47">int32_t</a> *&#160;</td>
          <td class="paramname"><em>threshold</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#gadb828ef50c2dbb783109824e94cf6c47">int32_t</a> *&#160;</td>
          <td class="paramname"><em>value</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#gadb828ef50c2dbb783109824e94cf6c47">int32_t</a> *&#160;</td>
          <td class="paramname"><em>minValue</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#gadb828ef50c2dbb783109824e94cf6c47">int32_t</a> *&#160;</td>
          <td class="paramname"><em>maxValue</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#ga33594304e786b158f3fb30289278f5af">uint32_t</a> *&#160;</td>
          <td class="paramname"><em>triggerTime</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#ga1f1825b69244eb3ad2c7165ddc99c956">uint16_t</a>&#160;</td>
          <td class="paramname"><em>idx_OD_traceConfig</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#ga1f1825b69244eb3ad2c7165ddc99c956">uint16_t</a>&#160;</td>
          <td class="paramname"><em>idx_OD_trace</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize trace object. </p>
<p>Function must be called in the communication reset section.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">trace</td><td>This object will be initialized. </td></tr>
    <tr><td class="paramname">SDO</td><td>SDO server object. </td></tr>
    <tr><td class="paramname">enabled</td><td>Is trace enabled. </td></tr>
    <tr><td class="paramname">timeBuffer</td><td>Memory block for storing time records. </td></tr>
    <tr><td class="paramname">valueBuffer</td><td>Memory block for storing value records. </td></tr>
    <tr><td class="paramname">bufferSize</td><td>Size of the above buffers. </td></tr>
    <tr><td class="paramname">map</td><td>Map to variable in Object Dictionary, which will be monitored. Same structure as in PDO. </td></tr>
    <tr><td class="paramname">format</td><td>Format of the plot. If first bit is 1, above variable is unsigned. For more info see Object Dictionary. </td></tr>
    <tr><td class="paramname">trigger</td><td>If different than zero, trigger time is recorded, when variable goes through threshold. </td></tr>
    <tr><td class="paramname">threshold</td><td>Used with trigger. </td></tr>
    <tr><td class="paramname">value</td><td>Pointer to variable, which will show last value of the variable. </td></tr>
    <tr><td class="paramname">minValue</td><td>Pointer to variable, which will show minimum value of the variable. </td></tr>
    <tr><td class="paramname">maxValue</td><td>Pointer to variable, which will show maximum value of the variable. </td></tr>
    <tr><td class="paramname">triggerTime</td><td>Pointer to variable, which will show last trigger time of the variable. </td></tr>
    <tr><td class="paramname">idx_OD_traceConfig</td><td>Index in Object Dictionary. </td></tr>
    <tr><td class="paramname">idx_OD_trace</td><td>Index in Object Dictionary.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success, -1 on error. </dd></dl>

</div>
</div>
<a id="ga5b8d9460d7a42920325cf66eb8b725ec"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5b8d9460d7a42920325cf66eb8b725ec">&#9670;&nbsp;</a></span>CO_trace_process()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CO_trace_process </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structCO__trace__t.html">CO_trace_t</a> *&#160;</td>
          <td class="paramname"><em>trace</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#ga33594304e786b158f3fb30289278f5af">uint32_t</a>&#160;</td>
          <td class="paramname"><em>timestamp</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Process trace object. </p>
<p>Function must be called cyclically in 1ms intervals.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">trace</td><td>This object. </td></tr>
    <tr><td class="paramname">timestamp</td><td>Timestamp (usually in millisecond resolution).</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success, -1 on error. </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Tue Jun 9 2020 17:29:32 for CANopenNode by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
